<html xmlns:saxon="http://icl.com/saxon">
   <head>
      <link rel="stylesheet" type="text/css" href="doc.css"/>
      <link rel="stylesheet" type="text/css" href=""/>
      <meta author="The MathWorks Ltd."/>
      <meta copyright="2011 The MathWorks Ltd."/>
      <title>Enable example</title>
   </head>

   
    <body>
      <table class="header" width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td bgcolor="#e4f0f8"><A href="User guide.html"><font face="Arial" bgcolor="#e4f0f8" size="+0" underline="0" color="#000000"><b>User guide</b></font></A></td>
            <td width="36" bgcolor="#e4f0f8"><A HREF="User guide3.html"><IMG SRC="Images/leftarrow.png" BORDER="0" ALT="previous page"/></A><A HREF="User guide3_2.html"><IMG SRC="Images/rightarrow.png" BORDER="0" ALT="next page"/></A></td>
         </tr>
      </table>
   

      <br clear="all"/>
          
      <h2>3.1: Enable example&nbsp;<a href="User guide3.html"><img src="Images/uparrow.png" border="0" align="top" alt="Go back up one level"/></a></h2>
      
            <p>(The code for this example can be found here: 
                            [ <a href="Examples/enableexample.m">view</a>
                | <a href="matlab: edit(fullfile(layoutRoot,'layoutHelp','Examples','enableexample.m'))">edit</a>
                | <a href="matlab: p=pwd();cd(fullfile(layoutRoot,'layoutHelp','Examples')); enableexample; cd(p)">run</a> ]
            )</p>
        <p>
            This example shows how the <code>enable</code> property can be
            used to indicate to users which bits of an interface are currently
            relevant. This is particularly useful for preventing unwanted
            clicking during long calculations, loading and saving!
        </p>
        
        <example>
            <para>Open a window and add a panel</para>
            <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">fig = <a href="matlab:doc figure"><code class="FUNCTION">figure</code></a>( 'Name', 'Enable example', ...
    'Position', [100 100 150 250], ...
    'MenuBar', 'none', ...
    'ToolBar', 'none', ...
    'NumberTitle', 'off' );
panel = <a href="uiextras.BoxPanel.html"><code class="FUNCTION">uiextras.BoxPanel</code></a>( 'Parent', fig, 'Title', 'Panel' );</font></pre>
            <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/EnableExample1.png"/></center></font></p>
        </example>
        <example>
            <para>Put some buttons inside the panel</para>
            <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">box = <a href="uiextras.VButtonBox.html"><code class="FUNCTION">uiextras.VButtonBox</code></a>( 'Parent', panel );
<a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 1' );
<a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 2' );
<a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 3', 'Enable', 'off' );
<a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 4' );
<a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 5', 'Enable', 'off' );
<a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 6' );</font></pre>
            <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/EnableExample2.png"/></center></font></p>
        </example>
        <example>
            <para>Try disabling the panel</para>
            <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">set( panel, 'Enable', 'off' );</font></pre>
            <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/EnableExample3.png"/></center></font></p>
        </example>
        <example>
            <para>Try enabling the panel. Note that the original "enable" state of each button is remembered.</para>
            <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">set( panel, 'Enable', 'on' );</font></pre>
            <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/EnableExample2.png"/></center></font></p>
        </example>
    
      
      <br clear="ALL"/>
      <table class="footer" width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td width="18" height="15" bgcolor="#e4f0f8" align="left"><a href="User guide3.html"><img src="images/leftarrow.png" border="0" alt="previous page"/></a></td>
            <td width="40%" height="15" bgcolor="#e4f0f8" align="left"><a href="User guide3.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">Enable and Visible</font></a></td>
            <td width="20%" height="15" bgcolor="#e4f0f8" align="center"><a href="index.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">[Top]</font></a></td>
            <td width="40%" height="15" bgcolor="#e4f0f8" align="right"><a href="User guide3_2.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">Visible example</font></a></td>
            <td width="18" height="15" bgcolor="#e4f0f8" align="right"><a href="User guide3_2.html"><img src="images/rightarrow.png" border="0" alt="next page"/></a></td>
         </tr>
      </table>
      <font face="Arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">&copy; 2011 The MathWorks Ltd</font>
      <TT>&#149; </TT><a href="matlab: helpview([matlabroot,'/license.txt'])">Terms of Use</a>
      <TT>&#149; </TT><a href="matlab: helpview([matlabroot,'/patents.txt'])">Patents</a>
      <TT>&#149; </TT><a href="matlab: helpview([matlabroot,'/trademarks.txt'])">Trademarks</a>
   
   </body>
</html>
        
